<extend name='Public/index'/>
<block name='content'>
<a class="button tiny" href="<{:U('addStudent')}>">添加</a>
	<table class='large-12 columns' id='Tbl'>
	<thead>
	<tr>
		<th><input type="checkbox" onclick="selectAll(this)" value='全选'></th>
		<th>编号</th>
		<th>期数</th>
		<th>姓名</th>
		<th>年龄</th>
		<th>性别</th>
		<th>电话</th>
		<th>操作</th>
	</tr>
	</thead>
	<tbody>
	<volist name='students' id='vo'>
	
	<tr id="row_<{$vo.student_id}>">
		<td><input type="checkbox" class='select' value='<{$vo.student_id}>' ></td>
		<td><{$vo.student_id}></td>
		<td><{$vo.term_id}></td>
		<td><{$vo.sname}></td>
		<td><{$vo.age}></td>
		<td><{$vo.sex}></td>
		<td><{$vo.mtel}></td>
		<td>
			<a href="<{:U('show',['id'=>$vo['student_id']])}>">查看详情</a>
		</td>
	</tr>
	</volist>
	</tbody>
	</table>
	<input type="button" class="button tiny" onclick="moreDel()" value='删除(批量)'>
	<input type="button" class="button tiny" onclick="unSelect()" value='反选'>

	<script>
	 function selectAll(obj) {
            $('#Tbl tbody .select').prop('checked',$(obj).prop('checked'));
        }
        function unSelect() {
            $('#Tbl tbody .select').map(function(){
                $(this).prop('checked',!$(this).prop('checked'));
            });
        }
	function moreDel() {
            if(!confirm('确定删除吗?')){
                return;
            }
            var ids = $('#Tbl tbody .select:checked').map(function () {
                $(this).parent().parent().remove();
                return $(this).val();
            });
            ids  = ids.get().join();
            $.post('<{:U("doDelStudent")}>',{ids:ids},function (data) {
                if(data['error'] ==0)alert(data['msg']);
            });
        }
	</script>
</block>